//
// Created by Administrator on 2021/8/13.
//
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <climits>

using namespace std;

class Solution {
public:
    char nextGreatestLetter(vector<char> &letters, char target) {
        auto index = upper_bound(letters.begin(), letters.end(), target);
        if (index == letters.end())
            return letters.front();
        else
            return *index;
    }
};

int main() {
    vector<char> letters{'c', 'f','j'};
    Solution solution;
    cout << solution.nextGreatestLetter(letters, 'i') << endl;
    return 0;
}
